<template>
  <div class="home">
    {{ msg }}
    {{ $store.state.msg.msg }}
    <button @click="fn()">加加加</button>
    <button @click="f1()">加加加</button>
    <button @click="fn1()">异步加</button>
    <button @click="f11()">异步加</button><br />
    {{ $store.getters["msg/fun"] }}
    {{ fun }}
  </div>
</template>

<script>
// @ is an alias to /src
import { mapState, mapMutations, mapActions, mapGetters } from "vuex";
import { ADC } from "../store/mutations-types";

export default {
  name: "HomeView",
  data() {
    return {
      str: "收敛收敛",
    };
  },
  components: {},
  computed: {
    ...mapState("msg", ["msg"]),
    ...mapGetters("msg", ["fun"]),
  },
  methods: {
    ...mapMutations("msg", [ADC]),
    ...mapActions("msg", ["CALC"]),
    fn() {
      this[ADC]("确实骚包");
    },
    fn1() {
      this.CALC("确实骚包");
    },
    f1() {
      this.$store.commit("msg/" + ADC, this.str);
    },
    f11() {
      this.$store.dispatch("msg/CALC", this.str);
    },
  },
};
</script>
